Add multi-agent shared state docs #265
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR documents the new multi-agent shared state feature that allows passing
invocation_state
to Graph and Swarm patterns. The feature enables sharing configuration, credentials, and context data across all agents in multi-agent patterns without exposing this information to the LLM.Type of Change
Motivation and Context
Following the implementation of PR #816 in the SDK, this documentation update is needed to help developers understand how to use the new
invocation_state
parameter with multi-agent patterns. The feature addresses a key customer need for sharing configuration and credentials across agents while maintaining proper separation of concerns.The original SDK PR introduced kwargs support to Graph and Swarm, allowing developers to pass shared state that gets propagated to all agents, tools, and hooks without being visible in LLM prompts.
Areas Affected
docs/user-guide/concepts/multi-agent/graph.md
- Added "Shared State" sectiondocs/user-guide/concepts/multi-agent/swarm.md
- Added "Shared State" sectiondocs/user-guide/concepts/tools/python-tools.md
- Added "Accessing Invocation State in Tools" sectiondocs/user-guide/concepts/agents/hooks.md
- Added "Accessing Invocation State in Hooks" sectionScreenshots
N/A - Documentation changes only
Checklist
mkdocs serve
Additional Notes
This documentation covers three key integration points for the shared state feature:
invocation_state
and what gets propagatedToolContext.invocation_state
The documentation emphasizes the important distinction between:
invocation_state
Cross-references between sections help developers understand the complete integration story across the framework.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.